home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / INPUT / FOCUS_PO.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.0 KB  |  65 lines

  1.  
  2. package sub_arctic.input;
  3.  
  4. import sub_arctic.lib.manager;
  5.  
  6. /** 
  7.  * Focus based input policy.  This policy delivers inputs to objects which
  8.  * have previously established themselves as a focus for a given type of input.
  9.  * @author Scott Hudson
  10.  */
  11. public class focus_policy_class extends input_policy {
  12.  
  13.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  14.  
  15.   /* Simple constructor. */
  16.   public focus_policy_class()
  17.     {
  18.       /* nothing extra to do here */
  19.     }
  20.  
  21.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  22.  
  23.   /** 
  24.    * Attempt to dispatch the event via one of the agents under this policy. 
  25.    * @param event evt the event to dispatch
  26.    * @return boolean whether the event was consumed.
  27.    */
  28.   public boolean dispatch_event(event evt)
  29.    {
  30.      dispatch_agent an_agent;
  31.   
  32.      /* walk down the agent list */
  33.      for (int i = 0; i < num_agents(); i++)
  34.        {
  35.          /* try to dispatch with the agent.  if it takes it, we are done */
  36.          an_agent = (dispatch_agent)_agent_list.elementAt(i);
  37.          if (an_agent.event_is_useful(evt) && 
  38.            an_agent.dispatch_event(evt, null, null, manager.event_seq_num()))
  39.          return true;
  40.        }
  41.   
  42.      /* nobody wanted it */
  43.      return false;
  44.    }
  45.  
  46.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  47. }
  48.  
  49. /*=========================== COPYRIGHT NOTICE ===========================
  50.  
  51. This file is part of the subArctic user interface toolkit.
  52.  
  53. Copyright (c) 1996 Scott Hudson and Ian Smith
  54. All rights reserved.
  55.  
  56. The subArctic system is freely available for most uses under the terms
  57. and conditions described in 
  58.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  59. and appearing in full in the lib/interactor.java source file.
  60.  
  61. The current release and additional information about this software can be 
  62. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  63.  
  64. ========================================================================*/
  65.